<?php
require_once(dirname(dirname(dirname(__FILE__))) . '/app.php');

need_manager();
need_auth('market');

if ( $_POST ) {
	$table = new Table('bd', $_POST);
	$table->create_time = time();
	$table->password = Zbd::GenPassword($table->password);
	$table->city_id = abs(intval($table->city_id));
	$table->enable = (strtoupper($table->enable)=='Y') ? 'Y' : 'N';
	$table->gender = (strtoupper($table->gender)=='M') ? 'M' : 'F';
	$table->insert(array(
		'username', 'password', 'realname', 'phone' , 'email', 'qq',
		'gender', 'city_id', 'enable', 'bank_name', 'bank_user', 'bank_no', 'create_time',
	));
	redirect( WEB_ROOT . '/manage/bd/index.php');
}

include template('manage_bd_create');
